package cn.hackcloud.guava;

import com.google.common.hash.BloomFilter;
import com.google.common.hash.Funnels;

public class BloomFilterTest {
    static double fpp = 0.00001;
    static int size = 1000000;
    static BloomFilter<Integer> filter = BloomFilter.create(Funnels.integerFunnel(), size, fpp);

    public static void main(String[] args) {
        for (int i = 1; i <= size; i++) {
            filter.put(i);
        }
        int count=0;
        for (int i = size; i < 2000000; i++) {
            if (filter.mightContain(i)) {
                count++;
            }
        }
        System.out.println(count);
    }
}
